%%
%方程组求根
%例2.3.1
syms a b c x
f = sym(a*x^2+b*x+c);
y = solve(a*x^2+b*x+c,x);
%%
%例2.3.2
syms x
y = solve(x^3-2*x+1);
%%
%例2.3.3
syms x y a b
[m,n] = solve(x^2-y-a,x+y-b,x,y)
%%
%例2.3.4
syms x
y = solve(sin(4*x)-log(x),x);%求得的结果是超解，需要用其他函数
%求出他的近似解，所以需要进行画图
y2 = sin(4*x)-log(x);
fplot(x,y2);
f = inline('sin(4*x)-log(x)','x');
y1 = fzero(f,0.7)
y3 = fzero(f,[0.5,1])
[x,f,h] = fsolve(f,0.7)
%%
%例2.3.5
syms x y
ezplot(x^2-y^3);
hold on
ezplot(exp(-x)-y);
t0=[0.5,0.5];
[t,f,h] = fsolve(@fun,t0);
hold off

%%
%函数进行解释
function f = fun(t)
x = t(1);
y = t(2);
f(1) = x^2-y^3;
f(2) = exp(-x)-y;
end















